#ifndef TSERVER_H
#define TSERVER_H
#include <QTcpSocket>
#include <QTcpServer>
#include <QMap>
#include <QByteArray>
#include "tdatabaseinfo.h"



enum class OPERATOR
{
    RECIVE_MESSAGE,
    SEND_MESSAGE
};

class TServer : public QTcpServer
{
    Q_OBJECT
public:
     TServer(QObject* parent = nullptr);
    ~TServer();
    void sendMessage(QTcpSocket* sender, const QByteArray& byteArray);
    OPERATOR getOperatorType(QByteArray& byteArray);
private slots:
    void onNewClientConnect();
    void onClientDisconnect();
    void onClientReadyRead();
private:
    void takeAction(QTcpSocket* socket, QByteArray byteArray);
    QMap<QString,QTcpSocket*> m_socketData;
};

#endif // TSERVER_H
